상세 컨텐츠

본문 제목

[iOS, android] 어플,브라우저 에서 다른 어플 app 앱 실행시키기,URL로 액티비티로 앱 실행하는 방법, 또 값넘기기(브라우저,앱에서 앱 실행 시키기)

스마트기기개발관련

by AlrepondTech 2020. 9. 23. 00:25

본문

반응형

 

 

 

 

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://gun0912.tistory.com/13

[안드로이드]URL로 액티비티 실행하는 방법(Custom URL Scheme)

우리는 보통 Activity를 실행시킬때 아래와 같이 코드를 작성합니다.

Intent intent = new Intent(this,AAA.class);
startActivity(intent);

 

만약 URL을 실행하고싶은 경우, 아래와 같이 해당 URL을 적어주고 ACTION_VIEW를 실행하면 브라우저가 실행되고 지정한 url을 로드하기도 합니다.

AndroidManifest.xml

            <intent-filter>

                   ...

                <data android:scheme="myapp" android:host="test" /> <!-- url 앱 실행  myapp://test -->

                 ...

             </intent-filter>

 

String url ="myapp://test"; // "myapp://test?val=123" <-이런식으로 '?' 뒤에 넘겨줄 값을 넣어도 된다. 
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);

만약 브라우저를 여러개 사용하고 있다면 url을 실행할때 브라우저를 선택하라는 화면이 나오기도 합니다.

 

 

URL을 선택하는 경우 뿐만 아니라 특정 액션을 수행할때 여러 어플리케이션이 중복된다면 하나를 선택하라는 화면이 나옵니다.

 

 

URL을 로드하는경우 브라우저를 선택하는 화면이 나오는건 해당 어플리케이션들이 http:// 라는 URL로 시작되는경우를 감지하고 이를 실행하려고 하기 때문입니다.

즉 'http://' 라는 Custom Scheme을 사용하고 있다고도 볼수 있습니다.

 

 

아직 이해가 잘 안되실거라 생각해서 좀더 실제적인 예로 설명해보겠습니다.

현재 제가 서비스하고있는 [셀폰]이라는 어플의 알림화면입니다.

(셀폰은 중고폰 개인거래/매입업체거래 중개서비스 입니다) 

셀폰 자세히 보기

 

 

 

여러 중고폰 판매글이 있고 내가 참여한 중고 판매글에 누군가가 댓글을 남긴경우 알림과함께 댓글내용을 알려주는 화면입니다.

(페이스북이나 기타 SNS에서 자주 보이는 패턴의 알림화면입니다.)

 

 

알림중 하나를 선택한경우 우리는 해당 판매글로 이동시키는 코드를 작성해야 합니다.

판매글의 id가 10번이고 판매글을 보여주는 Activity이름이 Activity_PostDetail일 경우 일반적으로는 아래와 같이 작성할 수도 있을것입니다.

Intent intent = new Intent(this,Activity_Post_Detail.class);
intent.putExtra(Activity_Post_Detail.STATE_POST_ID,"10");
startActivity(intent);

 

하지만 Custom URL을 사용한다면 아래와 같은 방법으로도 Activity를 실행시킬수 있습니다.

String url ="selphone://post_detail?post_id=10";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);

실행하고자하는 Activity이름을 지정하지 않고 단순히 url만을 입력하고 실행하는데도 같은 결과를 얻을수 있는것입니다.

 

이러한 방식을 사용하면 앱안에서 뿐만이 아니라 주소창에서도 특정 Activity를 실행시킬수 있습니다.

또한, Activity이름을 몰라도 해당 url을 넘겨주면 해당 url을 담당하는 Activity가 실행됩니다.

 

 

Custom URL Scheme작성하기

1. Menifest의 실행시키고 싶은 Activity에 scheme://host 형태의 URL을 정의해줍니다

위의 예시에서는 scheme은 selphone, host는 post_detail이 됩니다.

<!-- 개인거래 판매글 상세정보 -->

<activity
android:name=".post.Activity_Post_Detail"
android:theme="@style/Theme.Selphone.Transparent"

android:windowSoftInputMode="stateAlwaysHidden|adjustResize">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="kr.co.selphone.MainActivity" />

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="post_detail"
android:scheme="selphone" />
</intent-filter>
</activity>

이렇게 선언된경우 selphone://post_detail 이라는 url을 호출하는경우는 무조건 해당 Activity가 실행됩니다.

 

2. Activity를 실행하면서 parameter를 넘겨주고 싶은경우 쿼리형태로 넘겨줍니다

예시에서는 판매글의 id를 10으로 넘겨주었듯이 host뒤에 ? 를 붙여준뒤 쿼리 스트링을 넘겨줍니다.

"selphone://post_detail?post_id=10"

 

3. 실행되는 Activity에서 해당 parameter가 있는경우 parameter를 가져올수 있도록 설정합니다

Intent intent = getIntent();
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String temp_post_id = uri.getQueryParameter(STATE_POST_ID);
}

 

Activity가 ACTION_VIEW형태로 실행되었는지를 체크하고, uri로부터 parameter를 가져옵니다

(여기서 STATE_POST_ID 는 "post_id" 변수입니다.)

 

Custom URL Scheme을 사용하면 좀더 효과적으로 액티비티를 실행시키고 서로 상호작용하게 만들수 있습니다.

좀더 자세한 내용은 Android Intent Fileters를 참고하시면 좋습니다.

 

 

 

=======================

=======================

=======================

 

 

 

 

출처: https://ch7895.wordpress.com/2013/01/15/android-url-scheme-%EC%A3%BC%EC%86%8C%EC%B0%BD%EC%97%90%EC%84%9C-%EC%95%B1%EC%8B%A4%ED%96%89/

뭐할때 쓰는 녀석이냐면

ㄱ. A앱에서 B앱을 호출하고 싶을때,

ㄴ. 주소창에서 A앱을 실행시키고 싶을때,

ㄷ. 1,2번을 하면서 parameter로 값을 전달하고 싶을때.

 

방법은 간단하다.

우선 andoridmanifest.xml을 열어서 해당 activity에 intent 필터를 추가 시키고,

아래처럼 내용으로 채워준다.

<activity android:name=".ListViewActivity" android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" /> <data android:host="test2" android:scheme="bill" />
    </intent-filter>
</activity>

그리고 호출할때는

bill://test2 (스킴://호스트)

형식으로 하면 된다.

해석하면 bill://teset2를 주소창에 입력하면 ListActivity가 실행.

사실 이건 앱을 실행시킨다기보다는

해당 activity를 실행시키는 것이다.

intent filter의 action하고 category를 왜저렇게 했는지 궁금하면

http://developer.android.com/training/basics/intents/filters.html

여기보면 나와있다.

일단 이렇게 만들고 안드로이드 브라우저에서 bill://test2를 입력하면

본인의 목적과는 다르게 브라우저에서 구글링을 해버린다.

그래서 내가 만든게 잘못된나 싶어서 html페이지 하나 띄우고

거기다가 <a href=”bill://test2″> 하니까

그제서야 제대로 작동한다.

값얻어오는법

manifest에서 괜히 intent에 data 태그를 쓰는게 아니다.

if (getIntent() != null) {
    Uri uri = getIntent().getData();
    if (uri != null) {
        Log.d("MainAtv-receivedata", uri.toString());
        Log.d("MainAtv-receivedata", uri.getQueryParameter("confirm"));
    }
}

 

 

 

 

앱간 데이터 전달

네이티브 앱간에도 데이터 전달하는법.

받는부분이야 위에 적었던 부분하고 동일하고

보낼적에는

manifest에 설정한것 처럼 intent 하나 맹그러서

uri 담아가지고 보내믄 된다.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setData(Uri.parse("bill2://test2?r=receivedstartActivity(intent);

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://www.digipine.com/programming/6775

iPhone OpenURL으로 HTML에서 어플 실행

OpenURL URL Schemes, HTML에서 어플실행, 어플에서 어플실행, handleOpenURL 이용


요즘들어서 애플 결제 과금에 대한 고민을 많이 하는 것 같아서 공유해드립니다.
카드나 핸드폰 결제 페이지를 붙이면 애플에서 승인심사를 받는데, 다들 문제가 많죠!!!!

그래서 한 가지 방법을 제시할 가 합니다.

과금을 적용하는 데 좋은 방법은

과금 결제페이지는 홈페이지 즉, 모바일 웹페이지로하고
어플에서 사파리를 통한 결제페이지를 넘겼다가
결제가 끝나면 모바일 웹페이지에서 어플을 호출시키는 방법 입니다.


이럴 때 유용하게 이용하는 것이 OpenURL URL Schemes 입니다.
그냥 헤더처리 라고도 하더군요.

(1) 참고 url

1. http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

2. http://docs.burstly.com/guides/in-app-purchase-quick-start-guide.html#giving-your-app-an-openurl-url-scheme

3.  http://wiki.akosma.com/IPhone_URL_Schemes

 

(2) 설명

OpenURL URL Schemes, URL Schemes, handleOpenURL 이용방법 또는 Header, 헤더

라고 말하는 것을 간단히 말하면

test1234:// 와 같은 형태로 호출시 쓰이는 형태로,

홈페이지에서 http://와 같이 사용되는 형태의 머릿글 이라고 생각하면 좋겠다.

 

위에서 test1234는 어플 인증 App ID가 com.headercoco.test1234일 경우에 test1234를 말한다.

선언은 ㅇㅇㅇㅇ-info.plist 파일에 항목을 추가해야 한다.

1) info.plist에  URL Schemes 추가

2) 소스 어플프로그램AppDelegate.m에 handleOpenURL 메소드 추가

3) 다른 어플 또는 HTML에서 호출 사용 (HTML의 href를 이용 형태)

 

추가설명)Xocde에서 -info.plist 파일을 열고 URL Types를 추가하고 URL identifier에

com.yourcompany.myapp 형태로 입력하고 item0에 URL Schemes를 추가하여 item0에 url scheme에 연결될 스키마 이름을 myapp형태로 입력한다.

 

(3) 호출 예시

1) myapp://
2) myapp://some/path/here
3) myapp://?foo=1&amp;bar=2
4) myapp://some/path/here?foo=1&amp;bar=2

 (4) 소스 코딩1) 소스 어플프로그램AppDelegate.m에 추가

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 
{
  // Do something with the url here
}

 2) 사용 예시

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    if (!url) {  return NO; }
 
    NSString *URLString = [url absoluteString];
    [[NSUserDefaults standardUserDefaults] setObject:URLString forKey:@"url"];
    [[NSUserDefaults standardUserDefaults] synchronize];
    return YES;
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
 // 어플 자신이 호출된 경우에 얼럿창 띄우기 
 NSString *strURL = [url absoluteString];
  
 UIAlertView *alertView= [[UIAlertView alloc] initWithTitle:@"call message"
                                                       message:strURL                                                     
      delegate:nil                                         
     cancelButtonTitle:@"OK" otherButtonTitles:nil];
 
 [alertView  show];
 [alertView  release];
 
 return YES;
} 

 

 

=======================

=======================

=======================

 

 

 

출처: http://blog.hansune.com/504

실행시킬 수 있는 앱 정보 얻기

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager pm = context.getPackageManager();
List<resolveinfo> installedApps = pm.queryIntentActivities(mainIntent, 0);


for (ResolveInfo ai : installedApps) {
    Log.d("tag", ai.activityInfo.packageName);
}


실행시킬 패키지의 액티비를 알 경우,

ComponentName compName = new ComponentName("com.package","com.package.activity");
Intent intent = newIntent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setComponent(compName);
startActivity(intent);


실행시킬 패키지명만 알 경우,

Intent intent = context.getPackageManager().getLaunchIntentForPackage("ParkageName");
startActivity(intent);

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://ralf79.tistory.com/305

 

안녕하세요.

오랜만에 포스팅을 합니다.

 

이번에는 어플들간의 실행을 시킬때 사용하는 코드를 소개해드리려고 합니다.

 

Intent intent = getPackageManager().getLaunchIntentForPackage("packageName");

startActivity(intent);

 

이렇게 사용하시면 어플 안에서 다른 어플을 실행시킬수 있습니다.

도움이 되셧나요? ㅎㅎ

 

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://blog.daum.net/mailss/36

 

내가 만든 앱을 웹브라우저를 통해 실행시키고 데이터를 넘겨줄 수 있다. 잘 이해가 안된다면 지금 스마트폰의 웹브라우저를 통해서 아래 링크를 클릭해보면 쉽게 이해할 수 있다.

 

*다음 지도가 설치되었다면 클릭 (신도림역이 보일 것이다.)

*카카오톡이 설치되었다면 클릭 (이 블로그 url을 전송한다.)

 

1. 특정 URL을 사용한다고 선언

다음 지도의 경우 daummaps:// 로 시작하며 그 뒤에 액션 및 파라미터를 추가하여 사용한다.

*다음 지도 URL Scheme 설명 : http://dna.daum.net/apis/urlscheme/mmaps/intro

 

카카오톡의 경우 kakaolink:// 로 시작하며 그 뒤에 액션 및 파라미터를 추가하여 사용한다.

*카카오 링크 설명 : http://www.kakao.com/link/ko/api?tab=mobile

 

두 앱처럼 자신만의 url을 사용할 수 있게 해보자. 그러기 위해서는 manifest 파일에 선언해 주어야 한다.

액티비티 태그 안에 intent-filter를 추가하여 속성을 뷰여하자.

action은 View, category는 DEFAULT와 BROWSABLE.

 

여기까지는 url scheme를 사용하기 위한 준비이고 그렇다면 자신만의 url scheme를 등록해 보자.

마찬가리로 intent-filter에 data 를 추가한다. scheme는 http, daummaps, kakaolink 같은 프로토콜 부분이다. host는 www.daum.net과 같이 프로토콜 이후에 나오는 경로이다. 이 부분은 url을 사용하는 액티비티를 구분하던지, 동작형식을 구분하던지 자신에게 알맞는 용도로 사용하면 된다.

 

AndroidManifest.xml

<activity 
    android:name=".BkCalculatorActivity" 
    android:label="@string/title_activity_calc">
    <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data android:scheme="bk" android:host="calc"/>
    </intent-filter>
</activity>

 

2. 소스상에서 host 및 파라미터 받는 방법

url scheme를 사용하면 url 형태로 데이터가 들어오기 때문에 해당 url에서 어떤 액션인지 어떤 파라미터가 있는지 알아야 구분해서 처리를 할 수 있다.

 

url scheme 를 통해서 액티비티가 실행되면 intent에 data 가 포함되어 들어온다.

Uri data = getIntent().getData(); 를 통해서 data를 받아올 수 있다.

여기서 getIntent().getData(); 값이 null 인지 아닌지 체크를 해야 한다. 그냥 실행된 것인지 url 을 통해서 실행된 것인지 판단해야 하기 때문이다. 그냥 실행된 것이면 null 이된다.

 

Uri data = getIntent().getData();
if(data != null) {
    //url을 통해서 실행된 것. 파라미터를 받아서 작업 수행해야 함.
}

 

Uri의 다양한 메소드를 통해서 여러가지 값을 알 수 있다.

toString() 으로 전체 url 형태를 알 수 있다.

getHost() 로 host 값을 알 수 있다.

getQuery()로 전체 파라미터를 알 수 있다.

getQueryParameter(String key) 로 각각의 파라미터의 값을 알 수 있다.

 

만약 bk://calc?op1=25&op2=9&operator=+ 이렇게 url을 실행 시키면

scheme 는 bk가 되고 host는 calc가 되면 전체 query는 op1=25&op2=9&operator=+ 이다.

만약 getQueryParameter("op1") 을 하면 25 라는 값을 얻을 수 있다.

 

 

3. 샘플 프로젝트(단순 계산기)

웹 브라우저에서 계산할 값과 연산자를 url scheme로 넘겨주고 앱에서는 이 데이터를 받아서 계산을 수행하는 간단한 앱이다.

 

url 형태는 bk://calc?op1=25&op2=9&operator=+ 이렇 식이다.

 

  op1  계산할 첫 번째 값
  op2  계산할 두 번째 값
  operator  연산자 (+, -, ×, ÷, %)

 

실행결과

웹페이지 (25+4)

앱 실행 결과 (25+4) 

웹 페이지 (25/4)

앱 실행 결과 (25/4)

 

UrlScheme.zip
0.62MB

 

전체 샘플 코드 첨부하였습니다.

*글과 자료는 출처만 밝히시면 얼마든지 가져다 쓰셔도 됩니다

 

 

 

=======================

=======================

=======================

 

 

 

 

Note: Since the introduction of custom URL schemes, this post has consistently been the top read content on the blog. Although much is the same, there are a few nuances that have changed. This is a re-write of the original post, updated for the latest iOS and Xcode versions.

One of the coolest features of the iPhone/iOS SDK is an application’s ability to “bind” itself to a custom URL scheme and for that scheme to be used to launch the application from either a browser or from another application.

 

Registering a Custom URL Scheme

The first step is to create a custom URL scheme – start by locating and clicking on the project info.plist in the Xcode Project Navigator. With the plist displayed in the right pane, right click on the list and select Add Row:

From the list presented scroll down and select URL types.

 

 

Open the directional arrow and you’ll see Item 0, a dictionary entry. Expand Item 0and you will see URL Identifier, a string object. This string is the name for the custom URL scheme you are defining. It’s recommended to ensure uniqueness of the name that you reverse domain name such as com.yourCompany.yourApp.

 

 

Tap on Item 0 and add a new row, select URL Schemes from the drop-down and tap Enter to complete the row insert.

 

 

Notice URL Schemes is an array, allowing multiple URL schemes to be defined for an application.

 

 

Expand the array and tap on Item 0. This is where you will define the name for the custom URL scheme. Enter just the name, do not append :// – for instance, if you enter iOSDevApp, your custom url will be iOSDevApp://

 

 

Here is how the complete definition looks at this point:

 

 

Although I appreciate Xcode’s intention when using descriptive names, I find it helpful to see the actual keys created. Here’s a handy trick, right-click on the plist and select Show Raw Keys/Values, the output will look as follows:

 

 

There’s another output format that also has merit, XML, as it’s much easier to see the structure of the dictionary and the nested array and its entries. Tap the plist and this time choose Open As – Source Code:

 

 

Calling Custom URL Scheme from Safari

With the URL scheme defined, we can run a quick test to verify the app can be called as expected using the URL. Before we do that, I’ll create a barebones UI so we can identify the app with the custom URL. The app contains nothing more than a UILabel with the text “App With Custom URL.” Download source for creating iOS App with Custom URL Scheme.

 

 

Using the simulator, here’s how to call the app:

– Run the application from within Xcode
– Once installed, the custom URL scheme will now be registered
– Close the app via the Hardware menu in simulator and choose Home
– Start Safari
– Enter the URL scheme defined previously in the browser address bar (see below)

 

 

At this point Safari will close and the app will be brought to the foreground. Congratulations, you’ve just called an iPhone application using a custom URL scheme!

Calling Custom URL Scheme from Another iPhone App

Let’s take a look at how to call the custom URL scheme from another iPhone application. Again, I’ve created a very simple iPhone application with nothing more than a UILabel and a UIButton – the former shows a message that this is the app that will call another app via a custom URL scheme, the button starts that process.Download source for creating iOS App to call Custom URL Scheme.

 

 

The code inside the buttonPressed manages the URL processing:

- (void)buttonPressed:(UIButton *)button
{
  NSString *customURL = @"iOSDevTips://";
 
  if ([[UIApplication sharedApplication] 
    canOpenURL:[NSURL URLWithString:customURL]])
  {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
  }
  else
  {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
                          message:[NSString stringWithFormat:
                            @"No custom URL defined for %@", customURL]
                          delegate:self cancelButtonTitle:@"Ok" 
                          otherButtonTitles:nil];
    [alert show];
  }    
}

Line 5 we check to see if the custom URL is defined, and if so, use the shared application instance to open the URL (line 8). The openURL: method starts the application and passes the URL into the app. The current application is exited during this process.

Passing Parameters To App Via Custom URL Scheme

Chances are you’ll need to pass parameters into the application with the custom URL definition. Let’s look at how we can do this with.

The NSURL class which is the basis for calling from one app to another conforms to the RFC 1808 (Relative Uniform Resource Locators). Therefore the same URL formatting you may be familiar with for web-based content will apply here as well.

In the application with the custom URL scheme, the app delegate must implement the method with the signature below:

- (BOOL)application:(UIApplication *)application 
  openURL:(NSURL *)url 
  sourceApplication:(NSString *)sourceApplication 
  annotation:(id)annotation

The trick to passing in parameters from one app to another is via the URL. For example, assume we are using the following custom URL scheme and want to pass in a value for a ‘token’ and a flag indicating registration state, we could create URL as follows:

NSString *customURL = @"iOSDevTips://?token=123abct&registered=1";

As in web development, the string ?token=123abct&registered=1 is known as the query string.

Inside the app delegate of the app being called (the app with the custom URL), the code to retrieve the parameters would be as follows:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
        sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  NSLog(@"Calling Application Bundle ID: %@", sourceApplication);
  NSLog(@"URL scheme:%@", [url scheme]);
  NSLog(@"URL query: %@", [url query]);
 
  return YES;
}

The output from the app with the custom URL (using my Bundle ID), when called from another app, is as follows:

Calling Application Bundle ID: com.3Sixty.CallCustomURL
URL scheme:iOSDevTips
URL query: token=123abct&registered=1

Take note of the ‘Calling Application Bundle ID’ as you could use this to ensure that only an application that you define can interact directly with your app.

Let’s change up the delegate method to verify the calling application Bundle ID is known:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
        sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  // Check the calling application Bundle ID
  if ([sourceApplication isEqualToString:@"com.3Sixty.CallCustomURL"])
  {
    NSLog(@"Calling Application Bundle ID: %@", sourceApplication);
    NSLog(@"URL scheme:%@", [url scheme]);
    NSLog(@"URL query: %@", [url query]);
 
    return YES;
  }
  else
    return NO;
}

It’s important to note that you cannot prevent another application from calling your app via custom URL scheme, however you can skip any further processing and return NO as shown above. With that said, if you desire to keep other apps from calling your app, create a unique (non-obvious) URL scheme. Although this will guarantee you app won’t be called, it will make it more unlikely.

Custom URL Scheme Example Projects

I realize it can be a little tricky to follow all the steps above. I’ve included two (very basic) iOS apps, one that has the custom URL scheme defined and one that calls the app, passing in a short parameter list (query string). These are good starting points to experiment with custom URL’s.

Additional Resources

 

 

반응형

 

728x90

 

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_ttrend&wr_id=3328&sca=%B8%F0%B9%D9%C0%CFWeb

 

아이폰에서 웹을 통해서 앱을 바로가기나 실행할 수 있는 방법이 있나요?

전체댓글수 2


  • 지못미 10-08-27 23:09 소스보기
  • 아이폰앱에서 url로 접근가능하도록 하면 됩니다. 
    아이폰의 모바일 사파리에서 youtube:// 와 같이 호출하는 방식요.. 
    파라미터도 넘길수 있는걸로 압니다.. 
    아 저도 앱에 저기능 빨리 넣어야 하는데 --;;

 

 

=======================

=======================

=======================

 

 

 

 

출처ㅣ http://blowmj.tistory.com/entry/iOS-%EC%96%B4%ED%94%8C%EC%97%90%EC%84%9C-%EC%96%B4%ED%94%8C-%EC%8B%A4%ED%96%89%EC%8B%9C%ED%82%A4%EA%B8%B0%EC%95%B1%EC%97%90%EC%84%9C-%EC%95%B1-%EC%8B%A4%ED%96%89-%EC%8B%9C%ED%82%A4%EA%B8%B0

 

AppA 어플에서 AppB 어플을 실행시키기를 해보겠습니다.

OpenURL URL Schemes, URL Schemes, handleOpenURL 이용방법 또는 Header, 헤더

라고 말하는 것을 간단히 말하면

AppB:// 와 같은 형태로 호출시 쓰이는 형태로,

홈페이지에서 http://와 같이 사용되는 형태의 머릿글 이라고 생각하면 좋습니다.


위에서 AppB는 어플 인증 App ID가 com.test. AppB일 경우에 AppB를 말합니다.
  
호출 받는 쪽, 즉, AppB 에서 해줘야 하는 부분을 살펴보겠습니다.

선언은 projectname-info.plist 파일에 항목을 추가해야 합니다.

1) info.plist에  URL Schemes 추가

2) 소스 어플프로그램AppDelegate.m에 handleOpenURL 메소드 추가

3) 다른 어플 또는 HTML에서 호출 사용 (HTML의 href를 이용 형태)

 

추가설명)Xocde에서 -info.plist 파일을 열고 URL Types를 추가하고 URL identifier에 

com. test.AppA 형태로 입력하고 item0에 URL Schemes를 추가하여 item0에 url scheme에 연결될 스키마 이름을 AppB형태로 입력합니다.

그림으로 보겠습니다.

 

 
 위와 같이 
plist에다가. URL types 를 만들어
URL Schemes 와 URL identifier 을 정해서 지정한대로 설정해주어야 합니다.


이번엔 AppA, 즉 호출하는 쪽에서 호출하는 방법에 대해 알아보겠습니다.

간단히 버튼을 하나 만들어서 버튼이벤트에 호출하는 메소드를 추가했습니다.

BOOL isInstalled = [[UIApplication sharedApplication] openURL: [NSURL URLWithString:@"AppB://"];    

if (!isInstalled) {

    // 설치 되어 있지 않습니다! 앱스토어로 안내...

    //[[UIApplication sharedApplication] openURL: [NSURL URLWithString: appstoreurl]];

    
}

위와 같이 호출하면 호출이 됩니다.

그런데 정보를 넘기고 싶으시다고요? 그럼 또 방법이 있죠 ㅎㅎㅎㅎ

[[UIApplication sharedApplicationopenURL: [NSURL URLWithString:@"AppB://"];   
이렇게 호출을 해줄때 AppB:// 이 뒷부분에 넘기고 싶은 정보를 넘겨주시면됩니다.


[[UIApplication sharedApplicationopenURL: [NSURL URLWithString:@"AppB://넘기고 싶은정보"];

이렇게요,


그럼 AppB에서는


- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
여기에서 메세지를 받을 수 있습니다.

간단하게 받는 메세지 전부를 Alert창으로 띄우는 예제를 보시면,
 

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

	// 어플 자신이 호출된 경우에 얼럿창 띄우기 

	NSString *strURL = [url absoluteString];

    

	UIAlertView *alertView= [[UIAlertView alloc] initWithTitle:@"call message"

                                                       message:strURL

                                                      delegate:nil 

                                             cancelButtonTitle:@"OK" otherButtonTitles:nil];

    

	[alertView  show];

	[alertView  release];

    

	return YES;

}


 
위와 같습니다

 

 

=======================

=======================

=======================

 

 

 

 

출처: http://iosdevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html

 

Launching iPhone Apps With Custom URL Scheme – Part 1

SUN, OCT 26

COCOA

In an earlier post I talked about how to launch the browser from within an iPhone application using the UIApplication:openURL: method.

It is also possible to use this same technique to launch other applications on the iPhone that are very useful.

Examples of some of the key applications that you can launch via URL are:

  • Launch the Browser (see earlier post )
  • Launch Google Maps
  • Launch Apple Mail
  • Dial a Phone Number
  • Launch the SMS Application
  • Launch the Browser
  • Launch the AppStore

 

Launch Google Maps

The URL string for launching Google Maps with a particular keyword follows this structure:

http://maps.google.com/maps?q=${QUERY_STRING}

The only trick to this is to ensure that the value for the ${QUERY_STRING} is properly URL encoded. Here is a quick example of how you would launch Google Maps for a specific address:

// Create your query ...
NSString* searchQuery = @"1 Infinite Loop, Cupertino, CA 95014";
 
// Be careful to always URL encode things like spaces and other symbols that aren't URL friendly
searchQuery =  [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
 
// Now create the URL string ...
NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", searchQuery];
 
// An the final magic ... openURL!
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

Launch Apple Mail

Also very useful, is the ability to enable a user to quickly send an email by launching the email client in compose mode and the address already filled out. The format of this URI should be familiar to anyone that has done any work with HTML and looks like this:

mailto://${EMAIL_ADDRESS}

For example, here we are opening the email application and filling the “to:” address withinfo@iphonedevelopertips.com :

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@iphonedevelopertips.com"]];

Dial a Phone Number (iPhone Only)

You can use openURL: to dial a phone number. One advantage this has over other URLs that launch applications, is that the dialer will return control back to the application when the user hits the “End Call” button.

Anyone familiar with J2ME or WML will find this URL scheme familiar:

tel://${PHONE_NUMBER}

Here is an example of how we would dial the number (800) 867-5309:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];

NOTE When providing an international number you will need to include the country code.

Launch the SMS Application

Also not supported by the iPod Touch, is the ability to quickly setup the SMS client so that your users can quickly send a text message. It is also possible to provide the body of the text message.

The format looks like this:

sms:${PHONENUMBER_OR_SHORTCODE}

NOTE: Unlike other URLs, an SMS url doesn’t use the “//” syntax. If you add these it will assume it is part of the phone number which is not.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:55555"]];

NOTE: According to the official SMS specification, you should be able to send a body as well as the phone number by including “?body=” parameter on the end of the URL … unfortunately Apple doesn’t seem to support this standard.

Launching the AppStore

Finally, it is worth noting that you can launch the AppStore and have the "buy" page of a specific application appear. To do this, there is no special URL scheme. All you need to do is open up iTunes to the application you want to launch; right-click on the application icon at the top left of the page; and select Copy iTunes Store URL .

The URL will look something like this:

http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8

Launching the AppStore URL is exactly the same as you would launch the browser. Using the link above, here is an example of how we would launch the AppStore:

NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&amp;mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];

74 comments

URL schemes are great, but one important piece of information that you didn’t mention is that openURL: returns a boolean that can be used to determine whether the device is able to handle the URL.

For example if you do tel: or sms: on an iPod touch it will return NO and you can display an error message.

This becomes critical when you use URL schemes for applications you can download from the AppStore. My app, for example, allows you to add bookmarks to Delicious, but obviously the ‘yummy:’ URL scheme won’t work if it’s not installed!

by Stephen Darlington on Dec 3, 2008. Reply #

What about launching some other 3rd party application. Or starting some other process from one process?

by Raj on Dec 4, 2008. Reply #

@Stephen that is a great point. Thanks for the comment.

@Raj it is possible to invoke a 3rd party application ONLY if said application has taken the necessary steps to register the URL scheme with the phone. I’ll try to dig up an example to illustrate how this is done.

The URL scheme is the text before the “://” in the URL so if you wanted to create a scheme “foo” a URL would look like “foo://….”. You should even be able to pass parameters in the URL. I’ve not tried to do this yet, but as soon as I find out how I’ll post back here.

- Rodney

by Rodney on Dec 4, 2008. Reply #

@Stephen:
Is that correct? It may be true for tel: and sms: URL schemes, but I don’t think it applies to custom URL schemes.

In my testing openUrl: always returns YES, even when called with an unsupported URL scheme. I can’t find a way to prevent the OS from displaying its own “Unsupported URL” alert message, nor a way to query for supported URL schemes.

by Darren on Dec 11, 2008. Reply #

Darren, yes it does work even for custom URL schemes. The iPhone sometimes gets confused if you install and remove applications with URL schemes:

http://openradar.appspot.com/6045562

Maybe that’s what you’re seeing?

And no, there’s no (documented) way of discovering whether a URL scheme is supported. The way I do it try it and if it fails then disable the option next time. It’s imperfect but as far as I know the best you can do at the moment.

by Stephen Darlington on Dec 12, 2008. Reply #

Does anyone know how to launch a custom application from an email or sms?

Cheers

by David Heacock on Feb 3, 2009. Reply #

@David Heacock

The process of launching an application is as simple as including a URL in the email or sms message. Follow the steps in this article to register your application to respond to a particular URL and then just put that URL in your message.

NOTE: There is currently no push support so the user will still need to click the URL for it to actually open the application.

by Rodney Aiglstorfer on Feb 3, 2009. Reply #

@David Heacock

I forgot which article this was … the article you need that explains how to register your own application URL is located here:

http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

Cheers,
Rodney

by Rodney Aiglstorfer on Feb 3, 2009. Reply #

Anyway to launch the iPod app to start playing a certain song?

by Dho on Feb 3, 2009. Reply #

@Dho

To my knowledge this is not possible today.

by Rodney on Feb 3, 2009. Reply #

I’ve seen that Apple’s own iPhone apps can send an email from a special mailer view that comes and goes, within the app– similar to how we are allowed to pick and even add/edit Contacts from within our apps.

Does anyone know if this “SendMail” API has been made available to us in the SDK?

by Scenario on Feb 16, 2009. Reply #

@Scenario: nope, the “SendMail” API is not available unless you’re Apple. The only option is to use the mailto: URL scheme. Or include your own SMTP client.

Also, I found that I now see what @Darren is getting. This certainly worked in iPhone OS 2.0. Looks like something broke.

by Stephen Darlington on Feb 17, 2009. Reply #

Thanks guys, now how do you launch iphone’s built-in address book?

Generally code samples talk about creating own interface into the address database (e.g. using AddressBookUI), but say you want your app to just launch iphone’s “Contacts” app? Thx. Gabe.

by gabe on Feb 21, 2009. Reply #

@Gabe … I am not aware of a way to launch the Address book external to an App. Let us know if you find anything.

by Rodney Aiglstorfer on Feb 22, 2009. Reply #

Hi,
I have an app in which I need to play a video. Can you tell me if there is a way I can do it without using YouTube? Does QT player support being invoked using URL? Also, once the video is completed, I would like my application to be restored? Is it possible?

Appreciate any pointers on this.

Thanks.

by Pranathi on Apr 14, 2009. Reply #

Hi,
I want to open the calendar application from my custom application. What URL i can use for that.?

by anil on Apr 16, 2009. Reply #

Hi
i am trying openURL for mailto functionality but no success (in simulator) using 2.2.1. can any body tell where is problem
Also i want to enter date from my app into iphone calender, any body have any idea?

Thanks

by kanayl on May 7, 2009. Reply #

@kanayl

The simulator does not come loaded with the email application that is why you can’t use the mailto functionality in the simulator.

As for the calendar, there is not currently a way to do this.

by Rodney Aiglstorfer on May 7, 2009. Reply #

I am trying openurl for call option, Once the call ended it returns back to my application (restarting the application). Can anyone help me , i want to return back to the same place where i clicked to call.

Thanks

by Raji on May 27, 2009. Reply #

Hi Raji, I’m afraid that it can’t be done with the publicly available APIs.

by Stephen Darlington on May 28, 2009. Reply #

Thanks Stephen.

by Raji on May 29, 2009. Reply #

Hi,

I’m want to open an app if it’s also installed on the device, and notify the user otherwise, but the app hangs on the openurl line of code, so never beeps? Any ideas how I can work around this anyone?

BOOL win = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

if( win == 0 ) { void NSBeep(); };

by rob on May 29, 2009. Reply #

Rob,

NSBeep isn’t available as part of the iPhone’s API.

Cheers,
–> Stephen

by Stephen Darlington on Jun 4, 2009. Reply #

Thats great info thanks.
Just one beginners question. How do you go back to your app once you open the google maps.

Thanks

by Bruce on Jun 23, 2009. Reply #

@Bruce: Raji asked the same question. The answer has not changed since then (i.e., you can’t).

Some other information has changed. In 3.0 it is now possible to detect which URL schemes are available and there is also the mail sheet API that Scenario was looking for.

by Stephen Darlington on Jun 23, 2009. Reply #

Hi
i am trying to dial phone no from app but there is no effect against phone no. i am using
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8004664411"]];

where is the problem? thanks in advance.

by Kanyal on Jul 2, 2009. Reply #

Hi,
Is there any way (documented or not…) to open Mail.app *not* with the default Inbox view loaded rather than the compose view?
Thanks

by John on Aug 17, 2009. Reply #

What if I just want to query which other apps are installed on the iPhone? I know when the newest update Apple can recommend apps based on current installations. Is there any way to do this with public API? Thanks in advance.

by Game Soldier on Sep 11, 2009. Reply #

Hi,
Is it possible to launch the Camera application like this?
Thanks

by Steven Denenberg on Sep 11, 2009. Reply #

Steven,

You can take photos directly with the iPhone SDK without launching the Camera application, which allows you to stay within the application you are running. Or is there something specific within the camera application you are interested in?

John

by John Muchow on Sep 11, 2009. Reply #

Hi, John,
Thanks for responding. Actually, I have already programmed the camera in to the app, but I’m thinking of taking it out, because when the camera launches and a photo is taken, it adds 16.5 Meg to the “Real Memory” used by the app (according to Instruments) and I occasionally get a memory warning. I don’t want the app to crash when Apple reviews it! Instead, I might have the user launch his Camera app, take the pictures, then return to my app to select them from his camera roll and attach them to an email within my app. That takes much less memory.

There was a posting on Apple’s developer forum about using malloc to grab the memory you need for the camera, and not launch Camera if the memory is unavailable. Sounds intruiging, but it also sounds like adding too many complications. Do you have trouble with using Camera in apps because of memory considerations?

/Steve

by Steve Denenberg on Sep 11, 2009. Reply #

Hello!

Can I also open the SMS Application without specifing a number or anything? Just simply quit my app and start the SMS-App.
I want the user to stay in a conversation, if it is the case, select the contact(s) to send the text to within the SMS-Application itself. So could I do it like this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:"]];

I read somewhere that you may be banned from the AppStore, if you use “sms:” in your application. Is this true?

by Stefan on Sep 12, 2009. Reply #

Hi Steve,

Interesting question on the memory front and the camera. I didn’t experience any memory problems in using the camera in my applications, however, could have to do with what else is loaded in the application at the same time (or not loaded for that matter)

Are there other areas in your application where you tinker with how memory is managed. For example, in one application I was pushing the limits on memory and was able to save significant memory by not caching images as I wrote about here:

http://iphonedevelopertips.com/memory-management/images-and-caching.html

Let me know what you discover if you look into how memory used in your app.

John

by John Muchow on Sep 12, 2009. Reply #

Hi Guys,

Can you us this process to open the “Calendar” app, the “iPhones Voicemail” page & the “mail accounts” screen?

Thank you very much.

by Max on Oct 7, 2009. Reply #

Dialing a number in os 3.1 form our app has one issue .
Dialer doesn’t return control back to the application when the user hits the “End Call” button. Any one who can fixed this issue.

by Zorture on Oct 9, 2009. Reply #

Hi guys,

I want to know whether it is possible to launch the SMS application via OpenUrl Scheme with the preloaded message in 3.1.

by Subha on Oct 10, 2009. Reply #

Hi Gurus
i am working on iphone live tv app. i have a streaming link that will stream video and audio. but i don’t know how to launch video player in iPhone native app. any body have some idea or any help, how i can that. thanks in advance

by kanyal on Nov 24, 2009. Reply #

I tried to open the app store like you suggested:

NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=291586600&mt=8"];

[[UIApplication sharedApplication] openURL:appStoreUrl];

But I get an error from Safari saying “Safari can’t open page because too many redirects occurred”.
Any idea why?

by roei on Jan 4, 2010. Reply #

roei: the simulator will not open URL’s to the iTunes store, however the code will work on device.

by John Muchow on Jan 4, 2010. Reply #

Seen a few related / unanswered queries above… Does anyone know if there is a URL Scheme Reference for the iPhone iPod app? We’d like our site to redirect content to a (pref Apple) media app that handles M3U and PLS files from HTML anchor tag. Several blogs say M3U is supported on iPhone v3.x but I’m not seeing how that happens.

by Steve Raschke on Jan 21, 2010. Reply #

Will this approach work with ADHOC distributions or only distributions through the app store?

Jack

by Jack Hodges on Feb 3, 2010. Reply #

Hi,
I am trying to open another application present on appstore from my iphone application,by using ur above given code but safari showing an alert “LOTS OF REDIRECTION,NOT ABLE TO OPEN”

Tell me onething is it possible that from our application we are able to delete or uninstall other application present in our iphone.

by monika on Feb 5, 2010. Reply #

It sounds like you may be trying this on the simulator?? If so, try the application on a device and see if you have the same problem.

by John Muchow on Feb 5, 2010. Reply #

I have the two applications (MyApp1 that will launch MyApp2), and MyApp2, both installed and running on the device using ADHOC profiles. The code event cycle is working, because if I change from @”myapp2://” to @”http://foo” (in MyApp1) and select the item while running a Safari web page to foo is launched. But returning to @”myapp2://” does nothing. I wish that I could trace the behavior and find out what is going on. It seems clear that there is no knowledge of the url scheme for myapp2 available to MyApp1. In fact, I am not sure how MyApp1 would know about any url schemes. It seems like they have to be registered outside of the device to work and that is why I asked about the ADDHOC vs. APP STORE installation.

Jack

by Jack Hodges on Feb 5, 2010. Reply #

I am having the same issue ( defining a URL scheme with ADHOC distribution does not work ). Did you find a solution for this problem? Thanks.

by Ozzy on Jan 8, 2011. Reply #

Is there a way to send a predefined message instantly to another phone?

Maybe send a predifined sms or something simular?

by Lars Persson on Feb 17, 2010. Reply #

How can I launch an iPhone application from another iPhone application.

by Kumar Sharma on Apr 28, 2010. Reply #

Kumar, here is some information from Apple that may help:Communicating with Other Apps

by John Muchow on Apr 28, 2010. Reply #

Thank you very much. I used your code for sending my application. But I got troubled. When I am sending sms, I am not redirecting to my application, in stead of that I was put in sms application of iphone. So please help me redirecting to my application after sending sms.

by hardik on May 22, 2010. Reply #

When an app places a call using the iPhone4 dialler, can anyone suggest a way to return to the app AS SOON as the call has connected (not ended)?

Thanks, Peter

by Bluepeters on Sep 21, 2010. Reply #

Can any one tell me how to open “Apple Store” app from iPhone app!!
Thanks, GRD.

by grd on Dec 8, 2010. Reply #

Were you able to open the “Apple Store” app? Also, do you know how to go to a particular product?

by R.MO on Jul 21, 2011. Reply #

Hi Rodney,

i’m from Brazil, and don’t speak English, but I read this article and like to ask you if it’s possible open the phone app and play some keyboard tones, like those who need to be tapped to acces voice mail.

by Icaro on Dec 21, 2010. Reply #

Great article and comments! Is there any way to launch the mail.app that first opens the inbox (not the email composer)?

by Jon on May 6, 2011. Reply #

Hello,
This is a great article. I have one question, is it possible to launch the other app in background?
In other words, from my app, I click a button and it launches an other app but is running in the background so my application remains on top.
Thanks
lenbins

by lenbins on Jun 9, 2011. Reply #

The current iOS only supports launching in the foreground

by John Muchow on Jun 10, 2011. Reply #

Thank you.

by lenbins on Jun 10, 2011. Reply #

hi
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://*100#"]];
doesn’t work
that it is possible to make

by alexey on Jun 23, 2011. Reply #

Is it possible to launch an app that you have (not in App Store)?

Thanks.

by Nicolas on Jun 26, 2011. Reply #

If you are referring to launching an app on your device that was not downloaded from the app store? Sure, if the app is loaded and has a custom URL scheme defined, you can load/launch the app.

by John Muchow on Jun 27, 2011. Reply #

Ok, Thanks, Im Using GameSalad, Now I cant create the Custom URL :(

You know if there is a way to Use Open Url to send some information to my site, without leaving the App?
Thanks!

by Nicolas on Jun 27, 2011. Reply #

Hi there, will this work to launch an app using a “Web Clip” on the Home Page of an iPad?

What I want to do is put an app icon on my users’ iPad that launches a PDF file that is located at a certain spot in a WebDAV folder (no authentication required) on the internet directly in an App that has a custom URL scheme defined…

In Safari you can “Add To Home Page” and add a link onto the Home Page, so the idea would be to have an ibooks:// link rather than an http:// and it would open the pdf being linked to there within iBooks

by John on Aug 15, 2011. Reply #

Read that “One advantage this has over other URLs that launch applications, is that the dialer will return control back to the application when the user hits the “End Call” button.”

IS this true ? I am not able to achieve this :(

by Tannyz on Aug 24, 2011. Reply #

Thanks for the great code and discussion

by John on Oct 29, 2011. Reply #

I actually hvae the opposite question for google maps. Is there anyway to force google maps to stay in a browser on an ipad. I have ios5 and want links in my website to stay in the safari browser and not open the ipad app. This worked fine on ios4 but on ios5 everything goes to the app. Any thoughts?

by Paul Gross on Nov 9, 2011. Reply #

How can i return to my original app? I don’t know. help me.
URL Scheme works fine but how can i return to my main app?
help me

by ashok on Nov 24, 2011. Reply #

Ashok, the only way I know of to return to your app would be if your app has a URL scheme that can be called from the other app.

by John Muchow on Nov 24, 2011. Reply #

Can I use my code to ask the system to open a file, thus launching another app to handle the file open?
So I could open a PDF from my App and what ever PDF viewer is installed on the iphone/IPAD would load opening it.

Thanks…

by henry on Dec 4, 2011. Reply #

If I open Email app using URL scheme, how can I return to my app after sending an email through Email app?

by Sahiti on Jan 2, 2012. Reply #

FYI, here’s Apple’s documentation for these built-in URL schemes:
http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/

And here is Apple documentation on implementing your own custom URL scheme:
http://developer.apple.com/library/ios/DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW50

by Basil Bourque on Aug 18, 2012. Reply #

Can you launch an application from an application that is running in the background?

For example you can a background app collecting gps data, when it reaches a certain location you either send the app to the foreground or open another application automatically, is this possible?

Thanks!

by Brad on Oct 23, 2012. Reply #

Interesting question, I haven’t tried that.

by John Muchow on Oct 23, 2012. Reply #

how to Launch Clock App.??

by jigar on Dec 14, 2012. Reply #

The better way maybe is use bellow code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.com/apps/appname"]];

and directly appstore app will open on your idevice.

by Arash on Jan 20, 2013. Reply #

 

 

 

=======================

=======================

=======================

 

 

 

 

반응형


관련글 더보기

댓글 영역