googlesamples / ios-nearby

69 stars 30 forks source link

cannot make iOS receive NearBy message from Android #4

Closed sokol8 closed 8 years ago

sokol8 commented 8 years ago

Hi guys,

I have an issue: with Google Example Apps (iOS, Android):

with a custom app we make:

Both iOS and Android apps have API keys created for a specific platform inside a single Google Console project.

Any hints on how to make those work will be greatly appreciated!

sokol8 commented 8 years ago

Android is using: DISCOVERY_MODE_DEFAULT DISTANCE_TYPE_DEFAULT

iOS is using: kGNSDiscoveryMediumsDefault kGNSDiscoveryModeDefault

dan-webb commented 8 years ago

Hello,

Sorry for the problems! Can you enable debug logging on iOS, and send the logs? This can help us track down the cause of the problem. Do this before you create your GNSMessageManager:

[GNSMessageManager setDebugLoggingEnabled:YES];

This will produce some additional logs in the console. Since you're seeing different behavior for the two apps, can you send the logs for both? Thanks!

dan-webb commented 8 years ago

A few more things to check:

  1. Please double-check that you're using the same API key in the Google example app on both iOS and Android.
  2. In your iOS app, make sure you're storing the GNSSubscription object somewhere (in a property of another object, for example), to make sure it's not being deallocated prematurely. The debug logs will tell me if this is happening.
sokol8 commented 8 years ago

Hi Dan,

thanks for the quick response!

Addressing your points from the second comment:

1) Here's the configuration I'm using: devices: Samsung Galaxy Note 3 (Android 4.3) iPhone 6 (iOS 9.2.1) iPhone 6S Plus (iOS 9.2.1)

key configuration: A) I have a single project created in Google Dev Console with "Nearby Messages API" Enabled. Inside Credentials for "Nearby Messages API" I have: "iOS key 1" setup with my app Bundle Identifier "Android key 1" setup with my Package name and "SHA-1 certificate fingerprint"

in this configuration:

B) When I tried to set Android key into iOS app

Thus I assume that key configuration B) is not viable and my original key configuration is correct.

2) I have 2 properties of my view controller @property (nonatomic, strong) id publication; @property (nonatomic, strong) id subscription;

which are used to retain publication and subscription objects. iOS-iOS link works perfectly well for me (iOS device 1 receives messages from iOS device 2, and the other way around ) so I assume I implemented it correctly.

I will post the logs in a second.

sokol8 commented 8 years ago

Here's a "good" log - two iOS devices successfully communicating via NearBy messages

2016-02-04 11:46:56.478 NearBy-POC[1368:816640] Device ID: u:5Vw6aIgxygMVQ5nBGBFx9w 2016-02-04 11:46:56.507 NearBy-POC[1368:816640] Subscribe 2016-02-04 11:46:56.521 NearBy-POC[1368:816640] Tokens: 0 good, 0 bad, 0 broadcast 2016-02-04 11:46:56.521 NearBy-POC[1368:816640] Report RPC request: 0 token(s), 0 beacon(s), 0 directive(s) 2016-02-04 11:46:56.525 NearBy-POC[1368:816640] Report RPC request: Subscribe: 1 2016-02-04 11:46:57.129 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:46:57.131 NearBy-POC[1368:816640] Report RPC response: 6 directive(s), 0 token(s), 0 message(s) 2016-02-04 11:46:57.132 NearBy-POC[1368:816640] Audio: Token changed to: LYydtc5RslY 2016-02-04 11:46:57.134 NearBy-POC[1368:816640] BLE: Ad packet token changed to: sgdFIXYv1sM 2016-02-04 11:46:57.135 NearBy-POC[1368:816640] BLE: GATT token changed to: p-Fmq51oQkg 2016-02-04 11:46:57.147 NearBy-POC[1368:816640] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:46:57.147 NearBy-POC[1368:816640] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:46:57.180 NearBy-POC[1368:816640] Heard new token: <GCPToken 0x12ef081a0>: {tokenId -rRP94Zr1ak, first seen 11:46:57, last seen 11:46:57, [ble-adv]} 2016-02-04 11:46:57.615 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:46:57.615 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 3 token(s), 0 message(s) 2016-02-04 11:46:57.627 NearBy-POC[1368:816640] Tokens: 1 good, 0 bad, 3 broadcast 2016-02-04 11:46:57.628 NearBy-POC[1368:816640] Report RPC request: 4 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:46:57.969 NearBy-POC[1368:816640] Heard new token: <GCPToken 0x12eea1c60>: {tokenId qLt6JdKN4s4, first seen 11:46:57, last seen 11:46:57, [ble-gatt]} 2016-02-04 11:46:58.283 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:46:58.283 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 4 token(s), 0 message(s) 2016-02-04 11:46:58.296 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:46:58.296 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:46:58.974 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:46:58.975 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 0 message(s) 2016-02-04 11:46:59.240 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:46:59.397 NearBy-POC[1368:816721] Audio: Broadcasting started 2016-02-04 11:47:01.991 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:01.992 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:02.639 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:02.640 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 0 message(s) 2016-02-04 11:47:02.814 NearBy-POC[1368:816721] Audio: Broadcasting stopped 2016-02-04 11:47:03.739 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:03.763 NearBy-POC[1368:816721] Audio: Broadcasting started 2016-02-04 11:47:07.269 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:07.270 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:07.318 NearBy-POC[1368:816671] Audio: Broadcasting stopped 2016-02-04 11:47:07.906 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:07.907 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 0 message(s) 2016-02-04 11:47:08.240 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:08.267 NearBy-POC[1368:816672] Audio: Broadcasting started 2016-02-04 11:47:11.822 NearBy-POC[1368:816673] Audio: Broadcasting stopped 2016-02-04 11:47:12.602 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:12.633 NearBy-POC[1368:816673] Audio: Broadcasting started 2016-02-04 11:47:12.769 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:12.770 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:13.452 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:13.452 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 0 message(s) 2016-02-04 11:47:16.189 NearBy-POC[1368:816702] Audio: Broadcasting stopped 2016-02-04 11:47:17.106 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:17.138 NearBy-POC[1368:816721] Audio: Broadcasting started 2016-02-04 11:47:18.260 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:18.261 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:18.938 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:18.938 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:18.947 NearBy-POC[1368:816640] ----Application: recieved 'test-message-9' 2016-02-04 11:47:20.692 NearBy-POC[1368:816672] Audio: Broadcasting stopped 2016-02-04 11:47:21.717 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:21.758 NearBy-POC[1368:816702] Audio: Broadcasting started 2016-02-04 11:47:23.758 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:23.759 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:24.148 NearBy-POC[1368:816640] ----Application: posting 'test-message-4' 2016-02-04 11:47:24.149 NearBy-POC[1368:816640] Publish 2016-02-04 11:47:24.449 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:24.450 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:24.463 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:24.463 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:24.464 NearBy-POC[1368:816640] Report RPC request: Publish: 1 2016-02-04 11:47:25.314 NearBy-POC[1368:816702] Audio: Broadcasting stopped 2016-02-04 11:47:25.365 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:25.365 NearBy-POC[1368:816640] Report RPC response: 6 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:26.097 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:26.123 NearBy-POC[1368:816671] Audio: Broadcasting started 2016-02-04 11:47:29.255 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:29.255 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:29.680 NearBy-POC[1368:816673] Audio: Broadcasting stopped 2016-02-04 11:47:29.898 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:29.899 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:30.733 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:30.768 NearBy-POC[1368:816671] Audio: Broadcasting started 2016-02-04 11:47:34.267 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:34.270 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:34.323 NearBy-POC[1368:816721] Audio: Broadcasting stopped 2016-02-04 11:47:34.992 NearBy-POC[1368:816640] Audio: Broadcaster detected 2016-02-04 11:47:35.294 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:35.295 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:35.301 NearBy-POC[1368:816640] ----Application: recieved 'test-message-5' 2016-02-04 11:47:35.305 NearBy-POC[1368:816640] ----Application: lost 'test-message-9' 2016-02-04 11:47:36.865 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:36.898 NearBy-POC[1368:816721] Audio: Broadcasting started 2016-02-04 11:47:39.762 NearBy-POC[1368:816640] Tokens: 2 good, 0 bad, 3 broadcast 2016-02-04 11:47:39.762 NearBy-POC[1368:816640] Report RPC request: 5 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:47:40.452 NearBy-POC[1368:816702] Audio: Broadcasting stopped 2016-02-04 11:47:40.576 NearBy-POC[1368:816640] Report RPC response: Success 2016-02-04 11:47:40.576 NearBy-POC[1368:816640] Report RPC response: 0 directive(s), 5 token(s), 1 message(s) 2016-02-04 11:47:41.261 NearBy-POC[1368:816640] Audio: No broadcaster detected 2016-02-04 11:47:41.286 NearBy-POC[1368:816721] Audio: Broadcasting started

sokol8 commented 8 years ago

Here's a "bad" log - iOS and Android devices communicating:

2016-02-04 11:49:28.869 NearBy-POC[1373:817841] Device ID: u:5Vw6aIgxygMVQ5nBGBFx9w 2016-02-04 11:49:28.899 NearBy-POC[1373:817841] Subscribe 2016-02-04 11:49:28.913 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 0 broadcast 2016-02-04 11:49:28.913 NearBy-POC[1373:817841] Report RPC request: 0 token(s), 0 beacon(s), 0 directive(s) 2016-02-04 11:49:28.917 NearBy-POC[1373:817841] Report RPC request: Subscribe: 1 2016-02-04 11:49:30.006 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:30.008 NearBy-POC[1373:817841] Report RPC response: 6 directive(s), 0 token(s), 0 message(s) 2016-02-04 11:49:30.009 NearBy-POC[1373:817841] Audio: Token changed to: 1w34FDSidlc 2016-02-04 11:49:30.012 NearBy-POC[1373:817841] BLE: Ad packet token changed to: Z4UIHlpixIA 2016-02-04 11:49:30.012 NearBy-POC[1373:817841] BLE: GATT token changed to: dBRDtMXbV5Y 2016-02-04 11:49:30.024 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:30.025 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:30.454 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:30.454 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 0 message(s) 2016-02-04 11:49:32.132 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:32.261 NearBy-POC[1373:817905] Audio: Broadcasting started 2016-02-04 11:49:34.378 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:34.379 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:34.903 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:34.905 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 0 message(s) 2016-02-04 11:49:35.726 NearBy-POC[1373:817884] Audio: Broadcasting stopped 2016-02-04 11:49:36.727 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:36.743 NearBy-POC[1373:817925] Audio: Broadcasting started 2016-02-04 11:49:39.877 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:39.879 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:40.324 NearBy-POC[1373:817905] Audio: Broadcasting stopped 2016-02-04 11:49:40.763 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:40.763 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 1 message(s) 2016-02-04 11:49:41.349 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:41.387 NearBy-POC[1373:817884] Audio: Broadcasting started 2016-02-04 11:49:43.983 NearBy-POC[1373:817841] ----Application: posting 'test-message-7' 2016-02-04 11:49:43.985 NearBy-POC[1373:817841] Publish 2016-02-04 11:49:44.000 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:44.001 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:44.001 NearBy-POC[1373:817841] Report RPC request: Publish: 1 2016-02-04 11:49:44.943 NearBy-POC[1373:817923] Audio: Broadcasting stopped 2016-02-04 11:49:45.078 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:45.078 NearBy-POC[1373:817841] Report RPC response: 6 directive(s), 3 token(s), 1 message(s) 2016-02-04 11:49:45.091 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:45.092 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:45.973 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:45.975 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 1 message(s) 2016-02-04 11:49:47.226 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:47.262 NearBy-POC[1373:818066] Audio: Broadcasting started 2016-02-04 11:49:50.382 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:50.383 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:50.818 NearBy-POC[1373:818066] Audio: Broadcasting stopped 2016-02-04 11:49:51.230 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:51.231 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 1 message(s) 2016-02-04 11:49:51.731 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:51.767 NearBy-POC[1373:817923] Audio: Broadcasting started 2016-02-04 11:49:55.323 NearBy-POC[1373:817925] Audio: Broadcasting stopped 2016-02-04 11:49:55.422 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:49:55.422 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:49:56.285 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:49:56.285 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 0 message(s) 2016-02-04 11:49:56.393 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:49:56.434 NearBy-POC[1373:817884] Audio: Broadcasting started 2016-02-04 11:49:59.990 NearBy-POC[1373:817883] Audio: Broadcasting stopped 2016-02-04 11:50:00.875 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:50:00.915 NearBy-POC[1373:817925] Audio: Broadcasting started 2016-02-04 11:50:00.921 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:50:00.921 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:50:01.837 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:50:01.837 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 1 message(s) 2016-02-04 11:50:04.448 NearBy-POC[1373:817883] Audio: Broadcasting stopped 2016-02-04 11:50:05.259 NearBy-POC[1373:817841] Audio: No broadcaster detected 2016-02-04 11:50:05.304 NearBy-POC[1373:817883] Audio: Broadcasting started 2016-02-04 11:50:06.422 NearBy-POC[1373:817841] Tokens: 0 good, 0 bad, 3 broadcast 2016-02-04 11:50:06.422 NearBy-POC[1373:817841] Report RPC request: 3 token(s), 0 beacon(s), 6 directive(s) 2016-02-04 11:50:07.280 NearBy-POC[1373:817841] Report RPC response: Success 2016-02-04 11:50:07.281 NearBy-POC[1373:817841] Report RPC response: 0 directive(s), 3 token(s), 1 message(s)

sokol8 commented 8 years ago

Hi @dan-webb

do the logs I posted help? Can I help you in any other way so you can find what's causing the issue?

dan-webb commented 8 years ago

Yes, the logs are helping us track it down. We've identified a problem in the logic that affects the specific case in your app, and we're working on a fix.

As for the sample app, that looks like a different problem, usually caused by a misconfiguration of API key and bundle ID in the app.

I'll keep you up to date with the progress.

dan-webb commented 8 years ago

When you publish your message from Android, are you giving the message a non-empty type? And are you creating a subscription on iOS without a type? This is supposed to work (because a type-less subscription should receive messages of all types), but we just found a bug causing this scenario to fail.

If this is what you're doing, can you implement a workaround: Use the same message type for the publication & subscription?

sokol8 commented 8 years ago

Hi @dan-webb .

When I explicitly set message type on iOS to the same message type used on Android - I managed to receive messages on both iOS and Android.

Thanks for pointing this out!

dan-webb commented 8 years ago

That's great! Thanks for helping us track down this bug. We'll get the fix into the next release. On Mon, Feb 15, 2016 at 9:40 AM Kostiantyn Sokolinskyi < notifications@github.com> wrote:

Hi @dan-webb https://github.com/dan-webb .

When I explicitly set message type on iOS to the same message type used on Android - I managed to receive messages on both iOS and Android.

Thanks for pointing this out!

— Reply to this email directly or view it on GitHub https://github.com/googlesamples/ios-nearby/issues/4#issuecomment-184290969 .

patchpon commented 8 years ago

Hi @sokol8, I' also got the same issues with iOS side cannot receive Android message. Could you possibly share how you explicitly set the message type on iOS and Android ?

technololy commented 3 years ago

Hi @sokol8, I' also got the same issues with iOS side cannot receive Android message. Could you possibly share how you explicitly set the message type on iOS and Android ?

i have been able to make ios see each other. could you kindly share how you did android and ios to see each other?

sokol8 commented 3 years ago

@technololy frankly I don't remember what exactly we did. Based on my old comment from 2016 we

"...explicitly set message type on iOS to the same message type used on Android - I managed to receive messages on both iOS and Android."

@dan-webb wrote that they did fix this issue in next release which probably happened some time in 2016.

technololy commented 3 years ago

@technololy frankly I don't remember what exactly we did. Based on my old comment from 2016 we

"...explicitly set message type on iOS to the same message type used on Android - I managed to receive messages on both iOS and Android."

@dan-webb wrote that they did fix this issue in next release which probably happened some time in 2016.

Appreciate your quick response. Guess I'll dig around more. Appreciate

technololy commented 3 years ago

@technololy frankly I don't remember what exactly we did. Based on my old comment from 2016 we "...explicitly set message type on iOS to the same message type used on Android - I managed to receive messages on both iOS and Android." @dan-webb wrote that they did fix this issue in next release which probably happened some time in 2016.

Appreciate your quick response. Guess I'll dig around more. Appreciate

Just to add for anyone coming here too. what i eventually did was to ask the developer doing the merchant app to share his key so i added it to my client app and viola, connection between ios and android. cc @sokol8 thanks again now to bind this ios app it to my xamarin app

dimitar-lazarov commented 3 years ago

We have the same issue and still could not make it work. Setting the namespace and type on publish messages, and also the iOS subscription params, make the iOS able to see android device. But can't do the android device see the ios as messageNamespace is a read-only property in GNSMessage.

@technololy can you give more details of how you solved the problem?

technololy commented 3 years ago

We have the same issue and still could not make it work. Setting the namespace and type on publish messages, and also the iOS subscription params, make the iOS able to see android device. But can't do the android device see the ios as messageNamespace is a read-only property in GNSMessage.

@technololy can you give more details of how you solved the problem?

Hello

Presently driving interstate but to give a quick response, my own challenge was iOS seeing android. Android could see messages from any devices. To underline, I built my android app using xamarin forms and used the xamarin android binding. Changing the key was what solved the iOS seeing android for me...

sokol8 commented 3 years ago

@dimitar-lazarov in my initial issue Android did see all the messages from iOS. Same case as @technololy has at the moment

"iOS doesn't see any messages from Android while Android does receive a message from iOS."

hai199580 commented 3 years ago

I have same issue

Android work with Android IOS work with IOS

but Android not with IOS and IOS not with Android

@technololy @sokol8 can you give me example code or something like that :(( This issue took me 4 days :(

hai199580 commented 3 years ago

Here is my solution, base on @sokol8 comment

in IOS :

Publication option :

messageManager?.publication(with: pubMessage,
            paramsBlock: { (params: GNSPublicationParams?) in
              guard let params = params else { return }
              params.strategy = GNSStrategy(paramsBlock: { (params: GNSStrategyParams?) in
                guard let params = params else { return }
                params.discoveryMediums = .BLE
                params.discoveryMode = .default
                params.allowInBackground = false
              })
            })

Subscription options :

messageManager?.subscription(messageFoundHandler: { (message: GNSMessage?) in
            // Do something
        },
        messageLostHandler: { (message: GNSMessage?) in
            // Do something
        },
        paramsBlock:{ (params: GNSSubscriptionParams?) in
          guard let params = params else { return }
          params.strategy = GNSStrategy(paramsBlock: { (params: GNSStrategyParams?) in
            guard let params = params else { return }
            params.discoveryMediums = .default
            params.discoveryMode = .default
            params.allowInBackground = false
          })
        })

in Android :

Publication option :

private val mPublishOption : PublishOptions by lazy {
    val strategy = Strategy.Builder().setDistanceType(Strategy.DISTANCE_TYPE_EARSHOT).build()
    return@lazy PublishOptions.Builder()
            .setStrategy(strategy)
            .setCallback(mPublishCallback)
            .build()
}

Subcription options:

private val mSubscribeOptions : SubscribeOptions by lazy {
    if (packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        return@lazy SubscribeOptions.Builder()
                .setStrategy(Strategy.BLE_ONLY)
                .setCallback(mSubscribeCallback)
                .build()
    } else {
        Toast.makeText(this, "BLE NOT SUPPORTED", Toast.LENGTH_SHORT).show();
        val strategy = Strategy.Builder().setDistanceType(Strategy.DISTANCE_TYPE_EARSHOT).build()
        return@lazy SubscribeOptions.Builder()
                .setStrategy(strategy)
                .setCallback(mSubscribeCallback)
                .build()
    }
}

Hope it help !