Reputation: 519
In one of my apps i need to open an app, if the app does not exists, open the google play store to download the app. Well, this is the problem, the app does not have URL scheme, so, the only way to open that app is with the package name.
Now, the native way is
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("videoconference.geainternacional.com.telemedicina");
startActivity(launchIntent);
I can't translate the native code to Appcelerator code, can anyone help me with that? i am trying this with no success.
try{
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_VIEW,
data: "videoconference.geainternacional.com.telemedicina"
});
Ti.Android.currentActivity.startActivity(intent);
}
catch(e){
Titanium.Platform.openURL(params.URLedoctorANDROID);
}
Thanks in advance.
Axway Appcelerator Studio, build: 5.0.0.201712081732
SDK 7.1.0 G.A.
Upvotes: 0
Views: 524
Reputation: 519
I am answering my own question because in TiSlack, Joshua Quick give me the code to make it work.
The answer is:
try{
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_MAIN,
className: "videoconference.geainternacional.com.telemedicina.activities.PresentacionActivity",
packageName: "videoconference.geainternacional.com.telemedicina",
});
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
intent.setFlags(Ti.Android.FLAG_ACTIVITY_NEW_TASK);
Ti.Android.currentActivity.startActivity(intent);
}
catch(e){
Titanium.Platform.openURL(params.URLedoctorANDROID);
}
i hope this can help to someone else.
Upvotes: 1