0

I feel like this is an embarrassingly stupid question, but oh well, as long as I get an answer.

The purpose of an app intent Nearby Notification is that users who tap the notification will be taken to the Play Store to install an app if they don't have it, or it will open the app if it is already installed. My problem is that, even when it is already installed, tapping the notification always takes me to the Play Store listing for the app.

In the Google Beacons dashboard, I select a beacon from the list and then select "View Nearby Notifications" from the dashboard. I enter a title, the language, ensure production mode is selected, select "App intent" from the dropdown. Then I have fields for intent scheme, intent path, package name of the app.

Is an intent path required? Why isn't a host required?

I'm unclear about what intent filter I need to set in my AndroidManifest.xml. This is what I am trying:

<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="nearbyapidemo"
                      android:host="name.chadschultz.nearbyapidemo"/>
</intent-filter>

What am I doing wrong?

Chad Schultz
  • 7,770
  • 6
  • 57
  • 96
  • does this notifications getting fired from your app? – V-rund Puro-hit Apr 10 '17 at 13:03
  • This is a Nearby Notification that appears in the user's device as a low-priority notification. The message comes from a bluetooth beacon. It's part of the Nearby API. https://developers.google.com/nearby/notifications/overview – Chad Schultz Apr 10 '17 at 13:07

1 Answers1

2

A kind developer in real life pointed out my mistake. This is all I need to add in AndroidManifest.xml for the Activity I want to start:

<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="nearbyapidemo"/>
</intent-filter>

I did NOT need a value for the host. Silly mistake on my part! And then when I configure the beacons, I simply need to enter the scheme (whatever arbitrary value I entered for the scheme in AndroidManifest.xml and then the package name of the app. I can leave the path blank in both the manifest and the Beacon Console.

Now when I tap the Nearby Notification, it will install the app if not installed, or will open the app if it is installed.

Another tip I learned: I can test the Intent directly from ADB via

adb shell am start -a android.intent.action.VIEW -d "nearbyapidemo://" name.chadschultz.nearbyapidemo

(Replace nearbyapidemo with your scheme and name.chadschultz.nearbyapidemo with your package name)

Of course, the best test is to update the bluetooth beacon and tap the Nearby Notification when it appears.

Chad Schultz
  • 7,770
  • 6
  • 57
  • 96