i am developing an app where the user needs to go to some place, so, my client wants to use the WAZE App but i cant make it work in Android.
Acording to WAZE i must do this:
try
{
String url = "waze://?q=Hawaii";
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) );
startActivity( intent );
}
catch ( ActivityNotFoundException ex )
{
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "market://details?id=com.waze" ) );
startActivity(intent);
}
So, i am converting that to Titanium Code like this:
try{
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_VIEW,
data: waze
});
Titanium.Android.startService(intent);
}
catch(e){
Titanium.Platform.openURL("market://details?id=com.waze");
}
("waze" is a string var where i have the url)
But always goes to the "Catch" ad takes me to the Store. ( Waze is already installed on my device )
this is the link where you can find the information in waze homepage. https://www.waze.com/es-419/about/dev
Thanks in advance.
I think you need to create a new activity, not start a service. I believe your code in the try block should be:
try{
var intent = Ti.Android.createIntent({
action: Ti.Android.ACTION_VIEW,
data: waze
});
Ti.Android.currentActivity.startActivity(intent);
}
catch(e){
Titanium.Platform.openURL("market://details?id=com.waze");
}