Unable to see in the Unregistered tab of Google Beacon Tools app the Eddystone UID when trasmitting using the Android Beacon Library - ibeacon

I see the UID transmitted in Locate App from Radius but I am not able to see in Google Beacon Tools app . I want to register in Google the Eddystone-UID when I use a transmitter build with the Beacon Library. Code is the following. What am I not considering?
uuid = "0x56987753868952999aaa";
major = "0x577886654591";
beacon = new Beacon.Builder()
.setId1(uuid)
.setId2(major)
.setManufacturer(0x0118)
.setTxPower(-56)
.build();
beaconParser = new BeaconParser()
.setBeaconLayout("s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19");
beaconTransmitter = new BeaconTransmitter(getApplicationContext(),
beaconParser);
beaconTransmitter.setAdvertiseMode(
AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY);
beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
#Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
Log.d(TAG, "EMISION COORECTA: ");
super.onStartSuccess(settingsInEffect);
}

Related

Xamarin.UWP local notification not working

I have implemented a code to send Local Notifications for a particular date and time on Android and iOS platform.And, My code is working for Android and iOS platform.In Android,I am using AlarmManager.
and in iOS, UILocationNotification for sending notifications. But , I didn't find any solution for the UWP platform to implement the Local Notification feature
using Dependency Service as i got for Android and iOS platform. Is there any solution for sending local notifications for particular
date and time for all the platforms including "UWP"(mandatory) in Xamarin.forms????
Xamarin.UWP local notification not working
If you want to make Local notification fore Xamarin.Forms, please refer this document. But it has not implement UWP platform. So we need implement schedule notification within uwp and use dependency service to call it. And I have implement a simple you could refer.
interface
public interface INotificationManager
{
int ScheduleNotification(string title, string message,DateTime scheduledTime);
}
Implement
public class UWPNotificationManager : INotificationManager
{
int messageId = -1;
public int ScheduleNotification(string title, string message,DateTime scheduledTime)
{
messageId++;
string TOAST = $#"<toast>
<visual>
<binding template='ToastGeneric'>
<text>{title}</text>
<text>{message}</text>
</binding>
</visual>
<audio src =""ms-winsoundevent:Notification.Mail"" loop=""true""/>
</toast>";
Windows.Data.Xml.Dom.XmlDocument xml = new Windows.Data.Xml.Dom.XmlDocument();
xml.LoadXml(TOAST);
ScheduledToastNotification toast = new ScheduledToastNotification(xml, scheduledTime);
toast.Id = "IdTostone" + messageId.ToString();
toast.Tag = "NotificationOne";
toast.Group = nameof(UWPNotificationManager);
ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast);
return messageId;
}
}
Usage
private void OnScheduleClick(object sender, EventArgs e)
{
notificationNumber++;
string title = $"Local Notification #{notificationNumber}";
string message = $"You have now received {notificationNumber} notifications!";
notificationManager.ScheduleNotification(title, message,DateTime.Now + TimeSpan.FromSeconds(3));
}
Try to use
ToastNotificationManager.CreateToastNotifier().Show(toast);

Getting the SSID of the CONNECTED WIFI on IOS 12- Xamarin (Updated for iOS 13)

I could get the ssid of the connected wifi to my iPhone. After Installing Xcode 10 and Updating Visual Studio for Mac and Visual Studio 2017, it returns me an empty ssid.
This is my piece of code for getting the ssid:
public override string GetCurrentWiFi()
{
String ssid = "";
try
{
string[] supportedInterfaces;
StatusCode status;
if ((status = CaptiveNetwork.TryGetSupportedInterfaces(out supportedInterfaces)) != StatusCode.OK)
{
}
else
{
foreach (var item in supportedInterfaces)
{
NSDictionary info;
status = CaptiveNetwork.TryCopyCurrentNetworkInfo(item, out info);
if (status != StatusCode.OK)
{
continue;
}
ssid = info[CaptiveNetwork.NetworkInfoKeySSID].ToString();
}
}
}
catch
{
}
return ssid;
}
I tried to add "Access WiFi Information" entitlement for iOS 12 app as it is mentioned here but the app still get an empty ssid:https://forums.xamarin.com/discussion/139476/adding-access-wifi-information-entitlement-for-ios-12-apps
I would be thankful if anyone could help.
RESOLVED: I applied Access WIFI Information for my Apple ID. Then I regenerated my Provisioning profile again and open it in my Xcode. Do not forget to add Entitlements.plist in the Custom Entertainments in the ios Bundle Signing. Now it works correctly.
Updated for iOS 13: Apple announced that iOS 13, the CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information.
If your app requires valid Wi-Fi SSID and BSSID information to function, you can do the following:
· For accessory setup apps, use the NEHotSpotConfiguration API, which now has the option to pass a prefix of the SSID hotspot your app expects to connect to.
· For other types of apps, use the CoreLocation API to request the user’s consent to access location information.
So, I updated the above solution in the following way:
Add this key to your info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your Description</string>
Use the CoreLocation API to request the user’s consent to access location information.
private void GetLocationConsent()
{
var manager = new CLLocationManager();
manager.AuthorizationChanged += (sender, args) => {
Console.WriteLine("Authorization changed to: {0}", args.Status);
};
if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
manager.RequestWhenInUseAuthorization();
}
Call the GetLocationConsent() function before calling the "CaptiveNetwork".
To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app .
So you have to check Access WiFi Infomation in appid.

Xamarin IOS bluetooth scan not showing all device list

I am not getting all devices when I am trying to scan Bluetooth devices with my application. It does not show android and windows device list. I have attached screenshots to understand my problem.
Here is my code.
_centralManager = new CBCentralManager(DispatchQueue.CurrentQueue);
_centralManager.DiscoveredPeripheral += _centralManager_DiscoveredPeripheral;
_centralManager.UpdatedState += (object sender, EventArgs e) =>
{
var manager = sender as CBCentralManager;
if (manager.State == CBCentralManagerState.PoweredOn)
_centralManager.ScanForPeripherals(new CBUUID[0]);
};
Scan event:
public void _centralManager_DiscoveredPeripheral(object sender, CBDiscoveredPeripheralEventArgs e)
{
var device = e.Peripheral;
var rssi = e.RSSI;
var ads = e.AdvertisementData;
}
Note: In my app, I was show device which name is not equal to null or blank.
I had implemented GATTA server on an Android device and it worked.
First, run the app on an Android device, start the server and done.
https://github.com/androidthings/sample-bluetooth-le-gattserver/blob/master/java/app/src/main/java/com/example/androidthings/gattserver/GattServerActivity.java
In my case, I wanted to do this for android things. So I implemented the code in android things.

Android Facebook Native ads error: 1001 no fill on user device

Our application use Facebook Native Ad via mediation platform Mopub, and it works good, but we should move to another platform.
I've replaced SDK platform, using the same placementId and app_id and tested my application as Developer.
Everything works good in test mode with real ads also, but I cannot get ads on real devices.
I tried to implement Facebook Native without any mediation platforms(code in the bottom), but still have the same result.
So the issue is not in partner platform,but I cannot get ads on real devices. Facebook Native throws error: 1001 no fill
It looks very strange, because I have:
Application has real users and shows ads in the previous version.
Application in PlayMarket(but with the previous implementation) with same package Id, placementId and app_id.
Facebook has checked my app.
I can see requests from new and previous version.
Code and logs:
AndroidManifest:
//...
//...
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/app_id" />
Application build.gradle:
//...
ext {
supportLibraryVersion = '25.3.1'
playServicesVersion = '11.0.1'
FBVersion = "4.25.0"
}
dependencies {
compile project(':library')
compile fileTree(include: ['*.jar'], dir: 'libs')
//...
compile "com.facebook.android:audience-network-sdk:$FBVersion"
//...
}
FacebookNativeLoader.java:
//...
/**
* Initiate ad container for native ad
*/
Override
public View createContentView(Context context) {
log(" createContentView");
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
return inflater.inflate(R.layout.facebook_ad_native_view, null);
}
#Override
public void loadAd(final MyViewManager myViewManager, final ResultListener resultListener) {
log(" loadAd");
adNativeLayout = myViewManager.getContentView();
// Create ad request with Facebook ad PlacementId
adNative = new NativeAd(myViewManager.getContext(), adPlacementId);
//
adNative.setAdListener(new AdListener() {
#Override
public void onError(Ad ad, AdError adError) {
log("FacebookNative Ad Loading Failed." +
"Error:" + NATIVE_LOAD_ERROR +
" ErrorCode:" + adError.getErrorCode() +
" ErrorMessage" + adError.getErrorMessage());
//Call Error to hide ad layout
resultListener.onError(NATIVE_LOAD_ERROR);
}
#Override
public void onAdLoaded(Ad ad) {
log("FacebookNative Ad Loading Completed");
//...
// Download icon for native ad
if (adNative.getAdIcon() != null) {
String iconUrl = adNative.getAdIcon().getUrl();
if (iconUrl != null && iconUrl.length() > 0)
NativeAd.downloadAndDisplayImage(adNative.getAdIcon(), icon);
}
// Download cover for native ad
if (adNative.getAdCoverImage() != null) {
String coverUrl = adNative.getAdCoverImage().getUrl();
if (coverUrl != null && coverUrl.length() > 0)
NativeAd.downloadAndDisplayImage(adNative.getAdCoverImage(), contentImage);
}
//Show debug info
log("adNative.getCalltoAction() - " + adNative.getAdCallToAction());
log("adNative.getBody() - " + adNative.getAdBody());
log("adNative.getClickUrl() - " + adNative.getAdCallToAction());
BaseLockScreenManager.url = adNative.getAdCallToAction();
title.setText(adNative.getAdTitle());
text.setText(adNative.getAdSubtitle());
downloadButton.setText(adNative.getAdCallToAction());
// Add the AdChoices icon
LinearLayout adChoicesContainer = (LinearLayout) adNativeLayout.findViewById(R.id.ad_choices_container);
AdChoicesView adChoicesView = new AdChoicesView(myViewManager.getContext(), adNative, true);
adChoicesContainer.addView(adChoicesView);
//Call Success to show ads
resultListener.onSuccess(true);
}
#Override
public void onAdClicked(Ad ad) {
//Do something
}
#Override
public void onLoggingImpression(Ad ad) {
//Do something
}
});
//Register Ad container to catch user Interactions
adNative.registerViewForInteraction(adNativeLayout);
// Initiate a request to load an ad.
// Loading Ad started here...
adNative.loadAd();
}
In Facebook documentation "error: 1001 no fill" means:
This is a common error seen while testing, and relates to a "No Fill"
response; the most common reason for this is the user is not logged in
to the Facebook App when testing your mobile app or not logged in to
the Facebook mobile website when testing your mobile website.
Error 1001 - No Fill. May be due to one or more of the following:
- User not logged into Native Facebook App on Mobile Device(But real device logged into Native Facebook App)
Limit Ad Tracking turned on (iOS)(but this is not relevant for Android app)
Opt out of interest-based ads turned on (Android) (but I've turned value off)
No Ad Inventory for current user (What does it mean?)
Your testing device must have the native Facebook application installed.(but I tested on real device with real Facebook account)
Your application should attempt to make another request after 30 seconds.(but I'have the same result everytime)
LogCat messages:
Developer device:
FacebookLoader:
I/----FacebookLoader: loadAd
I/----FacebookLoader: createContentView
I/----FacebookLoader: Facebooknative Ad Loading Completed
I/----FacebookLoader: adNative.getCalltoAction() - Learn More
I/----FacebookLoader: adNative.getBody() - LAToken aims to tokenize assets worth $1.2 trillion by 2025.
I/----FacebookLoader: adNative.getClickUrl() - Learn More
User Device:
FacebookLoader:
I/----FacebookLoader: loadAd
I/----FacebookLoader: createContentView
I/----FacebookLoader: FacebookNative Ad Loading Failed.Error:669 ErrorCode:1001 ErrorMessage: No fill
What can be issue of it? Has somebody the same issue?
I'm afraid to make release without ability to be sure that user can see ads, because the main idea of our application is Advertisement.
step 1: goto play store download native Facebook app install and login
step 2: Then test your app "testing add loading success"
Other errors like : " FacebookAdapter: No fillI/TAG: No fill.I/Ads: Ad failed to load : 3"
then : goto Manifest file and add on application level : android:usesCleartextTraffic="true"
<application
.........
android:usesCleartextTraffic="true"
.......
/>

Google Play Store for private channel distribution

In my company, we want to distribute an android app for only internal users.
We have one Google apps account (admin account) with our own company's domain name (xyz#sample.com).
We have other employee's email id with the company domain name(xyz#sample.com) and these are not under the Google apps.
Do we need the same Google apps account for all the employees under Google apps admin? As we need to make the app downloadable to all the internal employees too.
OR
Is it possible to make the android app downloadable with our own server's created email ids.
For Google APP account, do we need to pay Rs.150/employee/month?
EDIT:
I do not want to publish my android app on other play store where Google can not interfere.Is there any store? I have searched and found that there are many stores available but which is trustworthy.
All you need is your app available on the web for a common download. After in android, you need to download the apk and notify the user to update.
Below is the code I use to download the .apk and install it.
public void UpdateApk(){
String nameapk = "youapp.apk";
String urlDownload = "http://youserver/" + nameapk;
HttpURLConnection conn = (HttpURLConnection) new URL(urlDownload).openConnection();
conn.setDoInput(true);
conn.setConnectTimeout(20000);
conn.connect();
InputStream is = conn.getInputStream();
String PATH = Environment.getExternalStorageDirectory() + "/download/";
File file = new File(PATH);
file.mkdirs();
File outputFile = new File(file, nameapk);
FileOutputStream fos = new FileOutputStream(outputFile);
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is.read(buffer)) != -1) {
fos.write(buffer, 0, len1);
}
fos.close();
is.close();
// till here, it works fine - .apk is download to
// sdcard in download file
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + nameapk)), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
youcontext.startActivity(intent);
}
To check the version of the app, see this answer:
https://stackoverflow.com/a/14313280/185022

Resources