I want to integrate Waze into my android application. I follow the steps from the link below.
https://www.waze.com/about/dev#android_api
I search through the questions and found this same one but it is for ios
Below is the code which i use.
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);
}
Why I got the following error when I run it?
Process: com.domain.appname, PID: 5711
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://details?id=com.waze }
Change
market://details?id=com.waze
to
https://play.google.com/store/apps/details?id=com.waze
you can also add this validation to avoid crash
intent.resolveActivity(getPackageManager()) != null