Permission request not showing on ios for location sharing - google-maps

I have been trying to make the location permission request work. Initially, it did, but after resetting the simulator and trying other simulators in ios it did not show up again. I've reset the devices to test it out again just to make sure. Below are the info.plist and the code in the concerned sections. Thanks for trying
info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>mApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>UIAppFonts</key>
<array>
<string>Ionicons.ttf</string>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>Octicons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Zocial.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
<string>fetch</string>
</array>
<key>NSLocationWhenInUseUsageDescription</key>
<string>CHANGEME: Location Always Usage Description</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>CHANGEME: Location Always Usage Description</string>
<key>NSMotionUsageDescription</key>
<string>CHANGEME: Motion updates increase battery efficiency by intelligently toggling location-services when device is detected to be moving</string>
</dict>
</plist>
Code:
class Home extends React.Component{
componentDidMount(){
navigator.geolocation.requestAuthorization()
}
render(){
return(
<View style={styles.container}>
<MapView showUserLocation={true}
// remove if not using Google Maps
customMapStyle={mapStyle}
provider={PROVIDER_GOOGLE}
style={styles.map}
region={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.015,
longitudeDelta: 0.0121,
}}
>
</MapView>
<MenuIcon navigation={this.props.navigation}/>
</View>
)
}}
export default createAppContainer(createSwitchNavigator(
{
Home: Home,
Other: Altern
},
{
initialRouteName: 'Home',
}
));
Settings:

Related

How to implement Google maps in Xamarin Forms (Android and iOS)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have a Google map API key and I want to use that to show maps in my Android app and iOS app using Xamarin Forms. Which library would you use to have less conflict on both OS?
An easy way to implement that is using the NuGet Xamarin.Forms.GoogleMaps
Xamarin.Forms.GoogleMaps features:
Map types
Traffic map
Map events
Panning with animation
Panning directly
Pins
Custom Pins
Pin drag & drop
Polygons
Lines
Circles
Custom map tiles
Follow the next steps to set up maps in your project:
Install the NuGet package Xamarin.Forms.GoogleMaps in all projects.
Android. Initialize the library in your MainActivity.cs in the OnCreate method:
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Xamarin.FormsGoogleMaps.Init(this, savedInstanceState); //Initialize GoogleMaps here
LoadApplication(new App());
}
In your AndroidManifest.xml.
Add the properties com.google.android.geo.API_KEY com.google.android.gms.version org.apache.http.legacy inside the tag <application>.
Also adds the required permissions ACCESS_COARSE_LOCATION ACCESS_FINE_LOCATION.
Add some uses-feature if you will use geolocation.
Your AndroidManifest.xml should look like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="yvan.eht.nioj" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="YourApp.Android">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="Your_Api_Key_Here" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
</manifest>
iOS. Initialize the library in your AppDelegate.cs in the FinishedLaunching method:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Xamarin.FormsGoogleMaps.Init("Your_Api_Key_Here");
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
In your Info.plist add the properties NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription NSLocationAlwaysAndWhenInUseUsageDescription
<? xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!--Your other Permissions may be on top -->
<!-- Just add the Permissions below -->
<key>NSLocationAlwaysUsageDescription</key>
<string>Can we use your location at all times?</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Can we use your location when your application is being used?</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Can we use your location at all times?</string>
</dict>
</plist>
DONE
Now you can add a map in your xaml and show it in your Android and iOS app like this:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
mc:Ignorable="d"
x:Class="YourApp.MainPage">
<ContentPage.Content>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<maps:Map x:Name="map" VerticalOptions="FillAndExpand"></maps:Map>
</Grid>
</ContentPage.Content>
</ContentPage>
OPTIONAL
Request runtime location permissions
If your application targets API 23 or later and needs to access the user's location, it must check to see if it has the required permission at runtime, and request it if it does not have it. This can be accomplished as follows:
In the MainActivity class, add the following fields:
const int RequestLocationId = 0;
readonly string[] LocationPermissions =
{
Manifest.Permission.AccessCoarseLocation,
Manifest.Permission.AccessFineLocation
};
In the MainActivity class, add the following OnStart override:
protected override void OnStart()
{
base.OnStart();
if ((int)Build.VERSION.SdkInt >= 23)
{
if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) != Permission.Granted)
{
RequestPermissions(LocationPermissions, RequestLocationId);
}
else
{
// Permissions already granted - display a message.
}
}
}
(Not necessary if you are using Xamarin Essentials) In the MainActivity class, add the following OnRequestPermissionsResult override:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
if (requestCode == RequestLocationId)
{
if ((grantResults.Length == 1) && (grantResults[0] == (int)Permission.Granted))
// Permissions granted - display a message.
else
// Permissions denied - display a message.
}
else
{
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}

need to remove <text xmlns="http://ws.apache.org/commons/ns/payload"> from output in using <xsl:output method="text> xslt mediator

I am using xslt mediator in wso2 studio developer.I add below code as local entity (add resource) in wso2 carbon->conf and use it in my xslt mediator as "key". I have list of objects in output in json format. because even I need list of one object so I use this mediator instead of foreach mediator.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet exclude-result-prefixes="xs" version="2.0" xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://schemas.datacontract.org/2004/07/Asa.Mbdp.Platform.Publish.Tmc.Head.Proxy"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t="http://tempuri.org/">
<xsl:output encoding="UTF-8" indent="yes" media-type="application/json" method="text"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
{
"Response":{
"LivePrices":[
<xsl:for-each select="s:Envelope/s:Body/t:LivePricesResponse/t:LivePricesResult/a:Close">
{
"Last":"<xsl:value-of select="a:Last"/>" ,
"Price":"<xsl:value-of select="a:Price"/>",
"Quantity":"<xsl:value-of select="a:Quantity"/>",
"Since":"<xsl:value-of select="a:Since"/>"
}
<xsl:if test="position()!=last()">,</xsl:if>
</xsl:for-each>
]
}
}
</xsl:template>
</xsl:stylesheet>
my response start with text tag that I do not want to have it in my response. how can I remove this text tag.
<text xmlns="http://ws.apache.org/commons/ns/payload">
{
"Response":{
"LivePrices":[
{
"Last":"1880" ,
"Price":"1851",
"Quantity":"0",
"Since":"2018-07-26T00:00:00"
}
]
}
}
</text>
I want this response:
{
"Response":{
"LivePrices":[
{
"Last":"1880" ,
"Price":"1851",
"Quantity":"0",
"Since":"2018-07-26T00:00:00"
}
]
}
}
After using XSLT place the below code in your sequence
<property name="messageType" scope="axis2" type="STRING" value="application/xml"/>
<payloadFactory media-type="json">
<format>$1</format>
<args>
<arg evaluator="xml" expression="$body//*" xmlns:ns="http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
<respond/>
This should give you the expected output

Can't get my mac launchd script to run for mysql

So I've installed mysql on my mac server and I'm trying to get it to run via launchd.
My command for starting up the server from cmd line is as follows:
mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --port=3306 --tmpdir=/tmp
This is my plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.oracle.oss.mysql.mysqld</string>
<key>ProcessType</key>
<string>Interactive</string>
<key>Disabled</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>SessionCreate</key>
<true/>
<key>LaunchOnlyOnce</key>
<false/>
<key>UserName</key>
<string>_mysql</string>
<key>GroupName</key>
<string>_mysql</string>
<key>ExitTimeOut</key>
<integer>600</integer>
<key>Program</key>
<string>/usr/local/mysql/bin/mysqld</string>
<key>StandardOutPath</key>
<string>/usr/local/mysql/logs/mysqld.info.log</string>
<key>StandardErrorPath</key>
<string>/usr/local/mysql/logs/mysqld.error.logg</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld</string>
<string>--user=_mysql</string>
<string>--basedir=/usr/local/mysql</string>
<string>--datadir=/usr/local/mysql/data</string>
<string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
<string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
<string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
<string>--port=3306</string>
<string>--tmpdir=/tmp</string>
</array>
<key>WorkingDirectory</key>
<string>/usr/local/mysql</string>
</dict>
</plist>
This is the error I'm getting from the system.log:
Oct 9 11:10:28 PMAs-Mac-Pro com.apple.xpc.launchd[1] (com.oracle.oss.mysql.mysqld[1190]): Service could not initialize: 15A284: xpcproxy + 12644 [1472][19011403-4854-3CCD-9FCF-49C36302EB40]: 0xd
Oct 9 11:10:28 PMAs-Mac-Pro com.apple.xpc.launchd[1] (com.oracle.oss.mysql.mysqld): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
From my understandings, this is a permissions error. I've made sure that /usr/local/mysql is owned my _mysql, so I'm not sure what the problem is there.
I've also double checked the permission of the plist file:
-rw-r--r-- 1 root wheel 1607 Oct 9 11:42 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

.tmLanguage -- how to include / exclude a variable

I am looking for examples to include / exclude a couple of variables as defined within a .tmLanguage file.
Example 1 -- highlight the whole enchilada, including both variables:
{\code_one*[variable_one]{variable_two}}
Example 2 -- highlight the whole enchilada, less either or both variables:
{\code_two*[variable_three]{variable_four}}
include_variable_text -- e.g., \hspace*{3.45in}; \begin{singlespace*}; \end{document}.
.tmLanguage
<!-- BEGIN include_variable_text -->
<dict>
<key>begin</key>
<string>\\makebox\[|\\hspace\*\{|\\begin\{|\\end\{</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>lawlist.include_variable_text.begin.latex</string>
</dict>
</dict>
<key>end</key>
<string>\}|\]</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>lawlist.include_variable_text.end.latex</string>
</dict>
</dict>
<key>name</key>
<string>lawlist.include_variable_text.latex</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$base</string>
</dict>
</array>
</dict>
<!-- END -->
tm.Theme
<!-- BEGIN lawlist.include_variable_text -->
<dict>
<key>name</key>
<string>Grayed-Out</string>
<key>scope</key>
<string>lawlist.include_variable_text.latex</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#E3E3E3</string>
<key>background</key>
<string>#FFFFFF</string>
</dict>
</dict>
<!-- END -->
exclude_variable_text
{\bf\uline{excluded_variable_text}}
.tmLanguage -- This code contains an extra three (3) keys for future use -- e.g., [anything]
<!-- BEGIN exclude_text -->
<dict>
<key>match</key>
<string>(?=\s)(?<=\\[\w#]|\\[\w#]{2}|\\[\w#]{3}|\\[\w#]{4}|\\[\w#]{5}|\\[\w#]{6})\s</string>
<key>name</key>
<string>meta.space-after-command.latex</string>
</dict>
<dict>
<key>begin</key>
<string>((\{\\bf)(?:\\uline|code_two|code_three))(?:(\[)([^\]]*)(\]))?(\{)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>lawlist.base.latex</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>lawlist.prefix.latex</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>lawlist.open_square_bracket.latex</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>lawlist.first_variable.latex</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>lawlist.close_square_bracket.latex</string>
</dict>
<key>6</key>
<dict>
<key>name</key>
<string>lawlist.open_wavy_bracket.latex</string>
</dict>
</dict>
<key>contentName</key>
<string>lawlist.second_variable.latex</string>
<key>end</key>
<string>\}\}</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>lawlist_close_wavy_bracket.latex</string>
</dict>
</dict>
<key>name</key>
<string>lawlist.whole_enchilada.latex</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
<!-- END exclude_text -->
*.tmTheme
<!-- BEGIN strong blue #0000FF -- uline exclude_text -->
<dict>
<key>name</key>
<string>Bold / Underline</string>
<key>scope</key>
<string>lawlist.base.latex|lawlist.open_square_bracket.latex|lawlist.first_variable.latex|lawlist.close_square_bracket.latex|lawlist.pen_wavy_bracket.latex|lawlist_close_wavy_bracket.latex</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#E3E3E3</string>
</dict>
</dict>
<!-- END -->

Google Map OpenLayers Kml icon Name

KML file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Name</name>
<description><![CDATA[]]></description>
<Style id="style140"><IconStyle>
<Icon>
<name>Name</name>
<href>icon/green.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>Name</name>
<description>Desc Name</description>
<styleUrl>#style140</styleUrl>
<Point>
<coordinates>12.7548360932222,59.2701399304516,0.000000</coordinates>
</Point>
</Placemark>
</Document>
</kml>
And i get this output:
but I want this:
So you can see the name of the point. What Is wrong in the kml file?
Thx!
I don't know if this helps, but I found that the method that you want to use does not work. I was able to set this programmatically in javascript. This allows you to have a label just above the redcircle icon that you create yourself.
Hope this helps!
javascript (minus other code to build map object etc):
function addLayer(){
var myStyles = new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
strokeColor: "#FFCC33",
strokeWidth:10,
strokeOpacity:1,
fillColor:"#003399",
fillOpacity: 1,
externalGraphic: "icons/redcircle.png",
labelYOffset: 15,
pointRadius: 5,
label:"${label}",
})
});
currentLayer = new OpenLayers.Layer.Vector("KML", {
styleMap: myStyles,
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "/kml/mymap.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
KML file:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<description><![CDATA[]]></description>
<Placemark>
<label>Name</label>
<description>Desc Name</description>
<Point>
<coordinates>-122.98676101, 49.16702016,0.000000</coordinates>
</Point>
</Placemark>
</Document>
</kml>
I see the tag of the placemark name rendered in white with full opacity by default in Google Earth. Try specifying a Label Style element in your style to get that color and opacity.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Name</name>
<description><![CDATA[]]></description>
<Style id="style140">
<IconStyle>
<Icon>
<name>Name</name>
<href>icon/green.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<color>ffff55ff</color>
</LabelStyle>
</Style>
<Placemark>
<name>Name</name>
<description>Desc Name</description>
<styleUrl>#style140</styleUrl>
<Point>
<coordinates>12.7548360932222,59.2701399304516,0.000000</coordinates>
</Point>
</Placemark>
</Document>
</kml>
This is how I solved my problem...hope this helps.
var layerData = new OpenLayers.Layer.Vector("test1", {
renderers: ["SVG", "Canvas", "VML"],
strategies: [new OpenLayers.Strategy.Save({
auto:true
}),new OpenLayers.Strategy.Cluster({
distance: clusteringDistance,
threshold: clusteringThreshold,
shouldCluster: function(cluster, feature) {
updateFeatureStyle(feature);
if (feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point" && boundArea >= maxBoundAreaForClustering) {
return OpenLayers.Strategy.Cluster.prototype.shouldCluster.apply(this, arguments);
} else {
return false;
}
}
})],
styleMap: clusterStyle
});
blankLayer = true;
layerData.setVisibility(false);
function updateFeatureStyle(feature) {
feature.style.label = "\n\n " + feature.attributes.name;
feature.style.labelAlign = 'ct';
feature.style.fontColor = 'red';
feature.style.fontFamily = 'Arial';
feature.style.fontSize = '10px';
feature.style.fontOpacity = 1;
feature.style.graphicTitle = feature.attributes.name;
}